SavedBool.cs 470 B

12345678910111213141516171819202122232425262728293031323334
  1. using UnityEditor;
  2. namespace ExternPropertyAttributes.Editor
  3. {
  4. internal class SavedBool
  5. {
  6. private bool _value;
  7. private string _name;
  8. public bool Value
  9. {
  10. get
  11. {
  12. return _value;
  13. }
  14. set
  15. {
  16. if (_value == value)
  17. {
  18. return;
  19. }
  20. _value = value;
  21. EditorPrefs.SetBool("Ext_" + _name, value);
  22. }
  23. }
  24. public SavedBool(string name, bool value)
  25. {
  26. _name = name;
  27. _value = EditorPrefs.GetBool("Ext_" + name, value);
  28. }
  29. }
  30. }